package com.pai4j.api.service;

import com.pai4j.common.bean.PAIResponseBean;
import com.pai4j.common.bean.PAIResponseBeanUtil;
import com.pai4j.remote.ugc.ChatMessageClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Collections;
import java.util.List;

@Service
public class ChatMessageService {


    @Autowired
    private ChatMessageClient chatMessageClient;


    public List<String> query(String sourceUserId, String targetUserId,
                              Long startTime, Long endTime, int count) {
        PAIResponseBean<List<String>> responseBean = chatMessageClient.query(sourceUserId, targetUserId, startTime, endTime, count);
        if (PAIResponseBeanUtil.isOk(responseBean)) {
            return responseBean.getData();
        }
        return Collections.emptyList();
    }
}
